﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System;

namespace LogInModule.Views
{
    public partial class MapSelection : UserControl
    {
        public Action<string> PlayGame;
        private string selectedPlace;

        public MapSelection()
        {
            InitializeComponent();
        }

        private void MainUSA_MouseEnter( object sender, MouseEventArgs e )
        {
            this.RegionName.Text = "USA";
        }

        private void MainUSA_MouseLeave( object sender, MouseEventArgs e )
        {
            this.RegionName.Text = "Choose region";
        }

        private void MainUSA_Click( object sender, RoutedEventArgs e )
        {
            this.InformationNote.Visibility = System.Windows.Visibility.Visible;
            this.SaveIt.Visibility = System.Windows.Visibility.Visible;
            this.RegionInformation.Text = "Nonpoint source pollution is a major cause of water pollution in the United States. Habitat loss affects not only the biodiversity of ecosystems, but humans as well. Air pollution affects plants by negatively impacting their physiology, causing low crop yields and a reduction in plant vitality.";
            this.NoteHeader.Text = "USA";
            this.PlayButton.Visibility = System.Windows.Visibility.Visible;

            this.selectedPlace = "USA";
        }

        private void PlayButton_Click( object sender, RoutedEventArgs e )
        {
            if ( !string.IsNullOrEmpty( this.selectedPlace ) )
            {
                if ( this.PlayGame != null )
                {
                    this.PlayGame( this.selectedPlace );
                }
            }
        }

        private void Button_MouseLeftButtonDown( object sender, RoutedEventArgs e )
        {
            //Australia
            this.InformationNote.Visibility = System.Windows.Visibility.Visible;
            this.SaveIt.Visibility = System.Windows.Visibility.Visible;
            this.RegionInformation.Text = "Many human activities including the use of natural resources have a direct impact on the Australian environment. These issues are the primary concern of the environmental movement in Australia.";
            this.NoteHeader.Text = "AUSTRALIA";
            this.PlayButton.Visibility = System.Windows.Visibility.Visible;

            this.selectedPlace = "Australia";
        }

        private void Button_MouseLeftButtonDown_1( object sender, RoutedEventArgs e )
        {
            //China
            this.InformationNote.Visibility = System.Windows.Visibility.Visible;
            this.SaveIt.Visibility = System.Windows.Visibility.Visible;
            this.RegionInformation.Text = "Throughout the Asia-Pacific region, rapid economic and population growth creates serious social consequences from environmental problems of urban excess, deforestation, overfishing, global warming, air pollution, and limited safe water supplies.";
            this.NoteHeader.Text = "ASIA";
            this.PlayButton.Visibility = System.Windows.Visibility.Visible;

            this.selectedPlace = "Asia";
        }

        private void Button_MouseLeftButtonDown_2( object sender, RoutedEventArgs e )
        {
            //Africa
            this.InformationNote.Visibility = System.Windows.Visibility.Visible;
            this.SaveIt.Visibility = System.Windows.Visibility.Visible;
            this.RegionInformation.Text = "South Africa's freshwater supply is almost stretched to its limit. Destruction of natural habitats, overfishing, introduction of exotic species and pollution are amongs the most important problems in all parts of Africa."; 
            this.NoteHeader.Text = "AFRICA";
            this.PlayButton.Visibility = System.Windows.Visibility.Visible;

            this.selectedPlace = "Africa";
        }
    }
}